آموزش ++C آموزش و سورس های برنامه نویسی به زبان ++C |
||||||||||||||||||||||||||||||||||||
جمعه 1 ارديبهشت 1391برچسب:, :: 16:17 :: نويسنده : کیوان مجنونی
برنامه ای که یادآوری: نحوه عملکرد توابع strchr و strrchr را نشان میدهد: #include #include using namespace std; void main(void) { char ch='r'; char string[] = "The quick brown dog jumps over the lazy fox"; char fmt1[] = " 1 2 3 4 5"; char fmt2[] = "12345678901234567890123456789012345678901234567890"; char* pdest; int result; cout<<"String to be searched: \n\t\t"< pdest=strchr(string, ch); result=pdest - string + 1; if( pdest != NULL ) cout<<"Result:\tfirst "< cout<<"Result:\t"< pdest=strrchr(string, ch); result=pdest - string + 1; if( pdest != NULL ) cout<<"Result:\tfirst "< cout<<"Result:\t"< //end نظرات شما عزیزان:
آخرین مطالب آرشيو وبلاگ پیوندهای روزانه پيوندها
![]() نويسندگان
|
||||||||||||||||||||||||||||||||||||
![]() |